home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / TSPA3340.ZIP / TSUNTJ.INT < prev    next >
Text File  |  1993-08-16  |  5KB  |  127 lines

  1. {$B-,D-,F-,I+,N-,R-,S+,V+}
  2.  
  3. (*
  4. Timo Salmi UNiT J
  5. A Turbo Pascal unit of file information and handling etc
  6. All rights reserved 24-Nov-91, 6-Dec-92, 19-Aug-92, 7-Nov-92, 30-Jun-93
  7.                     16-Aug-93
  8.  
  9. In the 24-Nov-91 update of USUNTH unit part of its routines were
  10. transferred here to TSUTNTJ. The transferred routines were
  11.   COPYFILE Copy a file from within a Turbo Pascal program
  12.   ISDIRFN  Is a name a directory or not
  13.   OPENEDFN Is an assigned textfile still open or not
  14.   PIPEDIFN Is the standard input from redirection
  15.   PIPEDNFN Is the standard output redirected to nul
  16.   PIPEDOFN Is the standard output redirected
  17.  
  18. This unit may be used and distributed freely for PRIVATE,
  19. NON-COMMERCIAL, NON-INSTITUTIONAL purposes, provided it is not
  20. changed in any way, and that a proper attribution is made. For ANY
  21. other usage, such as use in a business enterprise or a university,
  22. contact the author for the terms of registration.
  23.  
  24. The units are under development. Comments and contacts are solicited. If
  25. you have any questions, please do not hesitate to use electronic mail for
  26. communication.
  27. InterNet address: ts@uwasa.fi            (preferred)
  28. Bitnet address:   SALMI@FINFUN.BITNET
  29.  
  30. The author shall not be liable to the user for any direct, indirect or
  31. consequential loss arising from the use of, or inability to use, any unit,
  32. program or file howsoever caused. No warranty is given that the units and
  33. programs will work under all circumstances.
  34.  
  35. Timo Salmi
  36. Professor of Accounting and Business Finance
  37. Faculty of Accounting & Industrial Management; University of Vaasa
  38. P.O. BOX 297, FI-65101 Vaasa, Finland
  39. *)
  40.  
  41. unit TSUNTJ;
  42.  
  43. (* ======================================================================= *)
  44.                           interface
  45. (* ======================================================================= *)
  46.  
  47. uses Dos
  48. {$IFDEF VER40}
  49.      ,TSUNT45
  50. {$ENDIF}
  51.      ;
  52.  
  53. (* ====================================================================
  54.                    File status information
  55.    ==================================================================== *)
  56.  
  57. (* This function returns whether a name is a directory or not.
  58.    Avoid using this on an open file or standard devices.
  59.    PathStr is a predefined Turbo Pascal string type String[79].
  60.    See FAQPAS2.TXT in garbo.uwasa.fi:/pc/ts/tsfaqp*.zip for more
  61.    on the ISDIRFN functions *)
  62. function ISDIRFN (name : PathStr) : boolean;
  63.  
  64. (* This function returns whether a name is a directory or not.
  65.    Avoid using this on an open file or standard devices.
  66.    An alternative method *)
  67. function ISDIR2FN (name : string) : boolean;
  68.  
  69. (* Another alternative method for testing whether a name is a directory.
  70.    This is based on listing all the directories on the relevant drive,
  71.    and seeing whether the given name is found among them.
  72.    No leading or traling blanks or tabs are allowed in the name.
  73.    This is not very efficient, but it is robust, and instructive *)
  74. function ISDIR3FN (name : string) : boolean;
  75.  
  76. (* This function returns whether a text file is open or closed.
  77.                                    ^^^^
  78.    Naturally the FilePointer must have been assigned at an earlier stage.
  79.    Very convenient as a test in routines which close a file.
  80.    e.g. use: if OPENEDFN(f) then close(f);                                *)
  81. function OPENEDFN (var FilePointer : text) : boolean;
  82.  
  83. (* Is the standard input from redirection. Based on PC-Mag Vol 10 No 7, 374,
  84.    Duncan 412, Dettmann 602-603 *)
  85. function PIPEDIFN : boolean;
  86.  
  87. (* Is the standard output redirected. Based on PC-Mag Vol 10 No 7, 374,
  88.    Duncan 412, Dettmann 602-603 *)
  89. function PIPEDOFN : boolean;
  90.  
  91. (* Is the standard output redirected to nul. Based on PC-Mag Vol 10 No 7, 374,
  92.    Duncan 412, Dettmann 602-603 *)
  93. function PIPEDNFN : boolean;
  94.  
  95. (* ====================================================================
  96.                    Program information
  97.    ==================================================================== *)
  98.  
  99. (* Show the memory address where the interrupt is located *)
  100. procedure INTRLOCA (IntrNumber  : byte;
  101.                     var segment : word;
  102.                     var offset  : word);
  103.  
  104. (* Show the memory address to which the interrupt points *)
  105. procedure INTRADDR (IntrNumber  : byte;
  106.                     var segment : word;
  107.                     var offset  : word);
  108.  
  109. (* ====================================================================
  110.                       Perform tasks
  111.    ==================================================================== *)
  112.  
  113. (* Copy a file (of any type)
  114.    Status codes:
  115.    0 : ok
  116.    1 : FromFile does not exits
  117.    2 : ToFile already exists
  118.    3 : ToFile cannot be opened for writing (read-only,
  119.          write protected, invalid device)
  120.    4 : Error in writing to ToFile
  121.    5 : Copy error (disk probably full)
  122.    6 : Date stamp error
  123.    7 : Out of memory
  124. *)
  125. procedure COPYFILE (FromFile, ToFile : string; var status : byte);
  126.  
  127.